<?php
if (!defined('IN_XLP')) {
    exit('Access Denied');
}
$Document = array(
    'pageid' => 'menu-stat', //页面标示
    'pagename' => '微信菜单点击分析', //当前页面名称
    'mycss' => array(), //加载的css样式表
    'myjs' => array(), //加载的js脚本
	'footerjs'=>array('content/highcharts', 'content/exporting','content/calendar'),
    'head' => true, //加载头部文件
);

include getTpl('header', 'public');
?>
<!--顶部导航 开始-->
<?php include getTpl('top', 'public');?>
<!--顶部导航 结束-->
<!--左侧菜单 开始-->
<?php include getTpl('nav', 'public');?>
<!--左侧菜单 结束-->
<!--主体 开始-->
<!-- content -->

<section id="content"> 
  <!-- main padder -->
  <section class="main padder">
    <div class="clearfix">
      <h4><i class="fa fa-table"></i><?php echo trim($Document['pagename'],'_');?></h4>
    </div>
    <div class="row"> 
      <!-- table 11 -->
      <div class="col-lg-12">
        <section class="panel">
          <header class="panel-heading"> 访问统计 </header>
          <div class="panel-body">
            <div class="row text-small">
              <div class="col-sm-12 m-b-mini">
                <form id="signupForm" action="<?php echo U('menu/stat');?>" method="get" target="_self">
                <label class="col-md-1 control-label text-right">开始时间</label>
                <div class="col-sm-2 text-left">
                 <input class="form-control" type="text" id="stime" value="<?php echo $stime;?>" name="stime" onClick="new Calendar().show(this);" readonly /></div>
                 <label class="col-sm-1 control-label text-right">结束时间</label>
                  <div class="col-sm-2 text-left">
                  <input class="form-control col-sm-3" type="text" id="etime" name="etime"  value="<?php echo $etime;?>" onClick="new Calendar().show(this);" readonly /></div>
                  <div class="col-sm-1"><input class="btn btn-primary" id="ok-btn" type="submit" value=" 查看" /></div>
                </form>
              </div>
            </div>
          </div>
          <div class="panel-body">
            <div class="row text-small">
              <div class="col-sm-12 m-b-mini">
                <div id="container" style="margin:5px auto"></div>
              </div>
            </div>
          </div>
        </section>
      </div>
      <!--/ table 11 --> 
      
    </div>
  </section>
  <!--/ main padder --> 
</section>
<!--/ content --> 
<!--主体 结束--> 
<script>
$(function () {
$('#container').highcharts({
  chart: {
	  plotBackgroundColor: null,
	  plotBorderWidth: null,
	  plotShadow: false
  },
  title: {
	  text: '自定义菜单点击使用情况'
  },
  tooltip: {
	   formatter:function(){
           return'<b>'+this.point.name+'</b>: '+Highcharts.numberFormat(this.percentage, 2)+' %';
       }
  },
  plotOptions: {
	  pie: {
		  allowPointSelect: true,
		  cursor: 'pointer',
		  dataLabels: {
			  enabled: true,
			  color: '#000000',
			  connectorColor: '#000000',
			  formatter: function() {
				  return '<b>'+ this.point.name +'</b>: '+ Highcharts.numberFormat(this.percentage, 2) +' %';
			  }
		  }
	  }
  },
  series: [{
	  type: 'pie',
	  name: '点击比例',
	  data: [<?php
$str='';
if ($total){
	foreach($totalRs as $val){
		$str.='["'.$val['title'].'(共:'.$val['total'].'次)",'.$val['total'].'],';
	}
	$str=rtrim($str,',');
}
echo $str;
?>]
  }]
});
});
</script>
<?php
include getTpl('footer', 'public');
?>
